/*
 * @Author: yangzonglong
 * @Date: 2021-07-06 16:12:44
 * @version: v1.0.0
 * @Descripttion: table Radio
 * @LastEditors: yangzonglong
 * @LastEditTime: 2021-07-08 16:41:32
 * @Auditor: 
 */
import React from 'react';
import { Checkbox } from 'antd';

const Group = Checkbox.Group;

type DatItem = {
  id: string;
  label: string;
  value: string;
};

interface IProps {
  disabled?: boolean;
  value: string[];
  onChange(v: any): void;
  options: {
    dataSource?: DatItem[];
  };
}

const TableRadio = ({ options, value, onChange, disabled }: IProps) => {
  return (
    <Group value={value} onChange={onChange} disabled={disabled}>
      {options.dataSource?.map(item => (
        <Checkbox value={item.value} key={item.value}>{item.label}</Checkbox>
      ))}
    </Group>
  );
};

export default TableRadio;